#include<stdio.h>
int main()
{
	int T,i,n;
	scanf("%d",&T);
	for(i=0;i<T;i++)
	{
		int sum = 0,fl = 0;
		scanf("%d",&n);
		int floor[n];
		for(int j=0;j<n;j++)
		  scanf("%d",&floor[j]);
		for(int j=0;j<n;j++)
		{
			if(floor[j]>=fl)
			{
			  sum += (floor[j]-fl)*6+5;
			  fl += floor[j]-fl;
			}
			else
			{
			  sum += (fl-floor[j])*4+5;
			  fl -= fl-floor[j];
			}
		}
		printf("%d\n",sum);
	}
	return 0;
}
